//
//  MeViewController.m
//  e律师
//
//  Created by 韦淋 on 2017/5/15.
//  Copyright © 2017年 test. All rights reserved.
//

#import "MeViewController.h"
#import "MyInfoCell.h"
#define SCREEN_SIZE [UIScreen mainScreen].bounds.size
#define LEFTSIDE_WIDTH (SCREEN_SIZE.width * 0.5)
#define SCREEN [UIScreen mainScreen].bounds
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

#define  Scale  [UIScreen mainScreen].bounds.size.width / 375.0
#define  YScale [UIScreen mainScreen].bounds.size.height / 667.0

@interface MeViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic, strong) NSMutableArray *caseDataSource;
@property (nonatomic, strong) UITableView *myInfoTableView;
@end

@implementation MeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self InitializeInterface];
    self.view.backgroundColor = [UIColor whiteColor];
}
- (void)InitializeInterface{
    [self.view addSubview:self.myInfoTableView];
}
#pragma mark - Button Target
- (void)action_Submit:(UIButton *)sender{
    NSLog(@"提交 ");
}
#pragma mark - UITableViewDelegate/UITableViewDataSource
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 40;
}
//- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
//    return 6;
//}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 8;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 80;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 80;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSMutableArray *array = [NSMutableArray arrayWithObjects:@"姓名 ",@"出生日期 ",@"性别 ",@"身高 ",@"体重 ",@"BMI值 ",@"血型 ",@"中国 +86 ", nil];
    MyInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:@"myInfoCell" forIndexPath:indexPath];
    cell.titleLable.text = array[indexPath.row];
    if (indexPath.row == 7) {
        cell.titleLable.textColor = [UIColor blueColor];
    }
    if (indexPath.row == 1||indexPath.row ==2||indexPath.row ==3||indexPath.row ==4||indexPath.row ==5||indexPath.row ==6 ) {
        cell.inputInfo.hidden = YES;
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    NSLog(@"1");
    //    CaseDetailViewController *caseDetailVC = [[CaseDetailViewController alloc] init];
    //    [self.navigationController pushViewController:caseDetailVC animated:YES];
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    UIView *space = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 400)];
//    space.backgroundColor = [UIColor blueColor];
    
    UIButton *submitButton = [[UIButton alloc] initWithFrame:CGRectMake(10, 10, self.view.bounds.size.width - 20, 50)];
    submitButton.backgroundColor = [UIColor blueColor];
    [submitButton setTitle:@"提交 " forState:UIControlStateNormal];
    [submitButton addTarget:self action:@selector(action_Submit:) forControlEvents:UIControlEventTouchUpInside];
    submitButton.layer.cornerRadius = 3;
    submitButton.layer.masksToBounds = YES;
    [space addSubview:submitButton];
    
    return space;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    UIView *space = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 400)];
//    space.backgroundColor = [UIColor blueColor];
    
    //后期要传值
    UIImageView *headImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 50, 50)];
    headImageView.backgroundColor = [UIColor redColor];
    headImageView.layer.cornerRadius = 25;
    headImageView.layer.masksToBounds = YES;
    
    //后期要传值
    UILabel *nameLable = [[UILabel alloc] initWithFrame:CGRectMake(80, 10, 200, 50)];
    nameLable.text = @"Lynn";
    [space addSubview:headImageView];
    [space addSubview:nameLable];
    return space;
}

#pragma mark - Getter
//- (NSMutableArray *)caseDataSource{
//    
//    return _caseDataSource;
//}
- (UITableView *)myInfoTableView{
    if (!_myInfoTableView) {
        _myInfoTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_SIZE.width , SCREEN_SIZE.height ) style:UITableViewStyleGrouped];
        _myInfoTableView.backgroundColor = [UIColor colorWithRed:236/255.0 green:236/255.0 blue:236/255.0 alpha:1];
        _myInfoTableView.delegate = self;
        _myInfoTableView.dataSource = self;
        
        _myInfoTableView.estimatedRowHeight = 50;
        _myInfoTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
        [_myInfoTableView registerClass:[MyInfoCell class] forCellReuseIdentifier:@"myInfoCell"];
    }
    return _myInfoTableView;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
